﻿@{
    Layout = "~/Areas/Web/Views/Shared/_UserCenter.cshtml";
    ViewBag.Title = "订单详情";
}
@model Himall.Model.OrderInfo
@using Himall.Core
@using Himall.Model

<link href="~/Areas/Web/Content/order-detail.css" rel="stylesheet" />

<div class="box1 lh24">
    <div class="title">
        <span class="title_txt curr">订单详情</span>
    </div>
    <div class="border-box" style="padding:10px; width: 986px;">
        <div class="orderstate">
            <div class="mt">
                <strong>
                    订单号：@Model.Id&nbsp;&nbsp;&nbsp;&nbsp;状态：<span class="ftx14">@Model.OrderStatus.ToDescription()</span>
                    <span id="pay-button-1622972656"></span>
                </strong>
                <div class="fr">
                    <div class="toolbar"></div>
                </div>
                @if (Model.OrderStatus == Himall.Model.OrderInfo.OrderOperateStatus.Finish && Model.OrderCommentInfo.Count == 0)
                {
                    <a class="btn btn-4 fr" href="@Url.Action("index", "OrderEvaluation", new { id=@Model.Id})">评价</a>
                }
            </div>
            <div style="display:block" class="mc">
                @if (Model.OrderStatus == Himall.Model.OrderInfo.OrderOperateStatus.Finish)
                {
                    <label>订单已经完成，感谢您在本商城购物，欢迎您对本次交易及所购商品进行评价。</label>
                }
                <span class="flk13">
                    @if (Model.OrderCommentInfo.Count == 0 && Model.OrderStatus == Himall.Model.OrderInfo.OrderOperateStatus.Finish)
                    {
                        <a href="@Url.Action("index", "OrderEvaluation", new { id=@Model.Id})">发表评价</a>
                    }
                </span>
            </div>
        </div>
        @if (Model.OrderStatus != Himall.Model.OrderInfo.OrderOperateStatus.Close)
        {
            <div class="process">
                <div class="node fore ready">
                    <ul>
                        <li class="tx1">&nbsp;</li>
                        <li class="tx2">提交订单</li>
                        <li class="tx3" id="track_time_0">@Model.OrderDate</li>
                    </ul>
                </div>
                <div class="proce ready">
                    <ul><li class="tx1">&nbsp;</li></ul>
                </div>
                @{var pay = @Model.PayDate.HasValue ? "ready" : "wait";
                var send = @Model.ShippingDate.HasValue ? "ready" : "wait";
                var finish = @Model.FinishDate.HasValue ? "ready" : "wait";}
                <div class="node @pay">
                    <ul>
                        <li class="tx1">&nbsp;</li>
                        <li class="tx2">商品出库</li>
                        <li class="tx3" id="track_time_1">@Model.PayDate</li>
                    </ul>
                </div>
                <div class="proce @pay">
                    <ul>
                        <li class="tx1">&nbsp;</li>
                    </ul>
                </div>
                <div class="node @send">
                    <ul>
                        <li class="tx1">&nbsp;</li>
                        <li class="tx2">等待收货</li>
                        <li class="tx3" id="track_time_5">@Model.ShippingDate</li>
                    </ul>
                </div>
                <div class="proce @send">
                    <ul><li class="tx1">&nbsp;</li></ul>
                </div>
                <div class="node @finish">
                    <ul>
                        <li class="tx1">&nbsp;</li>
                        <li class="tx2">完成</li>
                        <li class="tx3" id="track_time_6">@Model.FinishDate</li>
                    </ul>
                </div>
            </div>
        }
        <div class="ordertrack mb10">
            <ul class="tab">
                <li class="curr" id="id_a">
                    <h2>订单跟踪</h2>
                </li>
                <li id="id_b">
                    <h2>付款信息</h2>
                </li>
            </ul>
            <div class="clr"></div>
            <div class="mc tabcon">
                <!--订单跟踪-->
                <input type="hidden" id="datesubmit-1622972656" value="2014-07-07 12:17:20">
                <table width="100%" cellspacing="0" cellpadding="0">
                    <tbody id="tbody_track">
                        <tr>
                            <th width="15%"><strong>处理时间</strong></th>
                            <th width="50%"><strong>处理信息</strong></th>
                            <th width="35%"><strong>操作人</strong></th>
                        </tr>
                    </tbody>
                    <tbody id="tbExpressData">
                        @foreach (var orderOperationLog in Model.OrderOperationLogInfo)
                        {
                            <tr>
                                <td>@orderOperationLog.OperateDate.ToString("yyyy-MM-dd hh:mm:ss")</td>
                                <td>@orderOperationLog.OperateContent</td>
                                <td>@orderOperationLog.Operator</td>
                            </tr>
                        }
                    </tbody>
                </table>
                <div class="extra">
                    <span id="jdshfs"> 送货方式：@Model.ExpressCompanyName</span>
                    <span>承运人：@Model.ExpressCompanyName</span>
                    <span>货运单号：@Model.ShipOrderNumber</span>
                </div>
            </div>
            <div class="mc tabcon hide">
                <!--付款信息-->
                <table width="100%" cellspacing="0" cellpadding="0">
                    <tbody>
                        <tr>
                            <td width="30%" id="daiFuName">
                                支付方式：
                                @if (@Model.OrderTotalAmount == 0)
                                {
                                    <span>积分支付</span>
                                }
                                else
                                {

                                    @Model.PaymentTypeName @Model.PayRemark
                                }
                            </td>

                        </tr>
                        <tr>
                            <td width="70%" id="daiFuPeople">支付时间：@Model.PayDate</td>
                            <td width="70%" id="daiFuPeople">支付单号：@Model.GatewayOrderId</td>
                        </tr>
                        <tr>
                            <td> 商品金额：<span class="ftx-04">￥ @Model.ProductTotalAmount.ToString("F2")</span></td>
                            <td> 运费金额：<span class="ftx-04">￥@Model.Freight.ToString("F2")</span></td>
                        </tr>
                        <tr>
                            <td> 订单优惠金额：<span class="ftx-04">￥@Model.DiscountAmount.ToString("F2")</span></td>
                        </tr>
                        <tr>
                            <td> 应支付金额：<span class="ftx-04">￥@Model.OrderTotalAmount.ToString("F2")</span></td>
                        </tr>
                        <tr>
                            <td></td>
                        </tr>

                    </tbody>
                </table>
                <div class="tb-ul"></div>
            </div>
        </div>
        <div class="orderinfo-box">
            <div class="mt">
                <strong>订单信息</strong>
            </div>
            <div class="mc">
                <!-- 节能补贴信息 --> <!--顾客信息-->
                <dl class="fore">
                    <dt>收货人信息</dt>
                    <dd>
                        <ul>
                            <li>收&nbsp;货&nbsp;人：@Model.ShipTo</li>
                            <li>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：@Model.RegionFullName @Model.Address</li>
                            <li>手机号码：@Model.CellPhone</li>
                        </ul>
                    </dd>
                </dl>
                <!-- 礼品购订单展示送礼人信息 --> <!--配送、支付方式-->
                <dl>
                    <dt>支付及配送方式</dt>
                    <dd>
                        <ul>
                            <li>
                                支付方式：@if (@Model.OrderTotalAmount == 0)
                                {
                                    <span>积分支付</span>
                                }
                                else
                                {

                                    @Model.PaymentTypeName @Model.PayRemark
                                }
                            </li>
                            <li>运&nbsp;&nbsp;&nbsp;&nbsp;费：<span class="ftx-04">￥@Model.Freight.ToString("F2")</span></li>
                        </ul>
                    </dd>
                </dl>
                <dl>
                    <dt>发票信息</dt>
                    @if (Model.InvoiceType != Himall.Model.InvoiceType.None)
                    {
                        <dd>
                            <ul>
                                <li>发票抬头：@Model.InvoiceTitle</li>
                                <li>发票内容：@Model.InvoiceContext</li>
                            </ul>
                        </dd>
                    }
                    else
                    {
                        <dd>
                            <ul>
                                <li>不需要开发票</li>
                            </ul>
                        </dd>
                    }

                </dl>
                <!--发票-->
                @*<dl>
                        <dt>发票信息</dt>
                        <dd>
                            <ul>
                                <li>发票类型：普通发票</li>
                                <li>发票抬头：个人</li>
                                <li>发票内容：明细</li>
                            </ul>
                        </dd>
                    </dl>*@
                <!-- 礼品购订单展示寄语信息 -->
                <!--备注-->
                <!--商品-->
                <dl>
                    <dt>
                        <span class="i-mt">商品清单</span>
                        <div id="couponListShow" class="prompt p-fquan">
                            <div id="couponList" class="pc"></div>
                        </div>
                        <div class="clr"></div>
                    </dt>
                    <dd class="p-list">
                        <table width="100%" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr>
                                    <th width="10%"> 商品货号 </th>
                                    <th width="10%"> 商品图片 </th>
                                    <th width="35%"> 商品名称 </th>
                                    <th width="10%"> 价格 </th>
                                    <th width="10%"> 调价</th>
                                    <th width="10%"> 商品数量 </th>
                                    <th width="15%">操作</th>
                                </tr>
                                @foreach (var orderItem in Model.OrderItemInfo)
                                {
                                    <tr>
                                        <td>@orderItem.ProductCode</td>
                                        <td>
                                            <div class="img-list" style="width:250px">
                                                <a href="@Url.Action("Detail", "Product", new { id = @orderItem.ProductId })" target="_blank" class="img-box">
                                                    <img width="50" height="50" title="" src="@orderItem.ThumbnailsUrl">
                                                </a>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="al fl">
                                                <a href="@Url.Action("Detail", "Product", new { id = @orderItem.ProductId })" target="_blank" class="flk13"> @orderItem.ProductName @orderItem.Color @orderItem.Size @orderItem.Version</a>
                                            </div>
                                            <div class="clr"></div>
                                            <div class="fl" id="coupon_1160338"></div>
                                        </td>
                                        <td><span class="ftx04"> ￥@orderItem.SalePrice.ToString("F2")</span></td>
                                        <td>
                                            <span class="ftx04">
                                                ￥@((-orderItem.DiscountAmount).ToString("F2"))
                                            </span>
                                        </td>
                                        <td>@orderItem.Quantity</td>
                                        <td>
                                            <span class="flk13">
                                                @if (Model.OrderStatus == Himall.Model.OrderInfo.OrderOperateStatus.Finish)
                                                {
                                                    <a href="@Url.Action("index", "OrderRefund", new { keywords = @Model.Id })">申请返修/退换货</a>
                                                }
                                            </span>
                                            @if (Model.OrderStatus != Himall.Model.OrderInfo.OrderOperateStatus.WaitPay && Model.OrderStatus != Himall.Model.OrderInfo.OrderOperateStatus.Close)
                                            {
                                                <a target="_blank" href="/cart/BatchAddToCart?skuids=@orderItem.SkuId&counts=@orderItem.Quantity" class="btn btn-4">还要买</a>
                                            }
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </dd>
                </dl>
                <!--条形码-->
                <div class="barcode">

                    <ul class="hide" id="sn_list"></ul>
                </div>    <!-- 商家运费险  -->
                <input type="hidden" value="" id="venderIdListStr">
                <div id="yunFeiXian"></div>
            </div>
            <!--金额-->
            <div class="total">
                <ul>
                    <li><span>总商品金额：</span>￥@Model.ProductTotalAmount.ToString("F2")</li>
                    <li><span>+ 运费：</span>￥@Model.Freight.ToString("F2")</li>
                    @if (ViewBag.Coupon > 0)
                    {
                        <li><span>- 优惠抵扣金额：</span>￥@ViewBag.Coupon.ToString("F2") </li>
                    }
                    @if (Model.IntegralDiscount > 0)
                    {
                        <li><span>- 积分抵扣金额：</span>￥@Model.IntegralDiscount.ToString("F2") </li>
                    }
                </ul>
                <span class="clr">ad</span>
                <span style="color:#EDEDED;"></span>
                <div class="extra">
                    应付总额：<span class="ftx04"><b>￥@Model.OrderTotalAmount.ToString("F2")</b></span>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        var ExpressCompanyName = '@Model.ExpressCompanyName';
        var ShipOrderNumber = '@Model.ShipOrderNumber';
        if (ExpressCompanyName != "" & ShipOrderNumber != "") {
            // 物流信息
            $.post('/UserOrder/GetExpressData', { expressCompanyName: ExpressCompanyName, shipOrderNumber: ShipOrderNumber }, function (result) {
                var html;
                var obj = jQuery.parseJSON(result);
                if (obj.message == "ok") {
                    var data = obj.data;
                    for (var i = data.length - 1; i >= 0; i--) {
                        html += '<tr><td>' + data[i].time + '</td>\
                             <td>' + data[i].context + '</td>';
                        html += '<td></td></tr>';
                    }
                }
                else {
                    html += '<tr><td colspan="3">该单号暂无物流进展，请稍后再试，或检查公司和单号是否有误。</td></tr>';
                }

                html += '<tr><td><a href="http://www.kuaidi100.com" target="_blank" id="power" runat="server" style="color:Red;">此物流信息由快递100提供</a></td></tr>';
                $("#tbExpressData").append(html);
            });
        }
        $('#id_a').bind('click', function () {
            $('#id_a').addClass('curr');
            $('#id_b').removeClass('curr');
            $($('.tabcon')[0]).show();
            $($('.tabcon')[1]).hide();
        });
        $('#id_b').bind('click', function () {
            $('#id_b').addClass('curr');
            $('#id_a').removeClass('curr');
            $($('.tabcon')[1]).show();
            $($('.tabcon')[0]).hide();
        });
    });
</script>